package chapter7.quarter4;

import java.io.File;

public class UseFile {
    public static void main(String[] args) {
        File f=new File("myAccount2.txt");
        System.out.println("the file is exists? -->"+f.exists());
        System.out.println("the file can write? -->"+f.canWrite());
        System.out.println("the file can read? -->"+f.canRead());
        System.out.println("the file is a file? -->"+f.isFile());
        System.out.println("the file is a directory? -->"+f.isDirectory());
        System.out.println("the file is absolute path? -->"+f.isAbsolute());
        System.out.println("the file's name is -->"+f.getName());
        System.out.println("the file's path is -->"+f.getPath());
        System.out.println("the file's absolute path is -->"+f.getAbsolutePath());
        System.out.println("the file's parent path is -->"+f.getParent());
        System.out.println("the file's last modified time is -->"+f.lastModified());
        System.out.println("the file's length is -->"+f.length());

        File newFile=new File("newFile");
        f.renameTo(newFile);
        System.out.println("\t rename the file to:"+newFile.getName());
        System.out.println(f+"is exists? -->"+f.exists());
        newFile.delete();
        System.out.println("delete"+newFile+"......");
        System.out.println(newFile+"is exists? -->"+f.exists());
    }
}
